package swust.fc.bean;

import java.lang.reflect.Method;

/**
 * Bean定义类，存储Bean的元数据信息
 *
 * @beanName Bean的名称
 * @beanClass Bean的类型
 * @scope Bean的作用域，默认为"singleton"
 * @factoryMethod 工厂方法（用于@Bean注解的方法）
 */
public class BeanDefinition {
    private String beanName; // Bean名称
    private Class<?> beanClass; // Bean类型
    private String scope = "singleton"; // 作用域，默认为单例
    private Method factoryMethod; // 工厂方法，用于@Bean方法

    /**
     * 构造函数
     *
     * @param beanName  Bean名称
     * @param beanClass Bean类型
     */
    public BeanDefinition(String beanName, Class<?> beanClass) {
        this.beanName = beanName;
        this.beanClass = beanClass;
    }

    public String getBeanName() {
        return beanName;
    }

    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    public Class<?> getBeanClass() {
        return beanClass;
    }

    public void setBeanClass(Class<?> beanClass) {
        this.beanClass = beanClass;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public Method getFactoryMethod() {
        return factoryMethod;
    }

    public void setFactoryMethod(Method factoryMethod) {
        this.factoryMethod = factoryMethod;
    }

    @Override
    public String toString() {
        return "BeanDefinition{" +
                "beanName='" + beanName + '\'' +
                ", beanClass=" + beanClass +
                ", scope='" + scope + '\'' +
                ", factoryMethod=" + factoryMethod +
                '}';
    }
}